# Python 2.6.4
# Project Euler, Problem 131
# Copyright 2010 Talha Zaman

from mine import isprime
count, i = 0, 1
while True:
    cenhex, i = 1+3*i*(i-1), i+1
    if cenhex >= 1000000: break
    if isprime(cenhex): count += 1
print count

